package createModel.prototypeModel;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringBeanPrototypeTest {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
        for (int i = 0; i < 10; i++) {
            User user = (User)context.getBean("user");

            System.out.println(user.hashCode());
        }
        /**
         *  原型模式, 每一个对象都是单独的地址
         * 4976137
         * 23873708
         * 31372558
         * 26829784
         * 12319236
         * 33553623
         * 32458211
         * 25192357
         * 970059
         * 12556121
         */
    }
}
